<template>
  <div class="coupon">
    <p class="title">创建的优惠券，平台审核通过后，可在活动中使用</p>
    <el-button type="primary"  @click="masknum = true">添加优惠券</el-button>
    <!-- <span class="my-btn my-background" @click="masknum = true">添加优惠券</span> -->
    <div class="table">
      <el-table :data="arr" stripe border style="width: 100%">
        <el-table-column type="index"  label="序号"></el-table-column>
        <el-table-column prop="couponName" label="优惠券名称"></el-table-column>
        <el-table-column prop="couponType" label="类型"></el-table-column>
        <el-table-column prop="createTime" label="规则"></el-table-column>
        <el-table-column prop="isChk" label="状态"></el-table-column>
        <el-table-column prop="address" label="审核时间"></el-table-column>
        <el-table-column prop="createTime" label="创建时间"></el-table-column>
        <el-table-column prop="priceNew" label="有效期"></el-table-column>
        <el-table-column prop="issueNum" label="发放量"></el-table-column>
        <el-table-column prop="settleState" label="领取量"></el-table-column>
        <el-table-column prop="priceNew" label="使用量"></el-table-column>
        <el-table-column prop="priceNew" label="总数量"></el-table-column>
        <el-table-column label="操作" width="200">
          <template slot-scope="scope">
            <el-button  type="text"
              >禁用</el-button
            >
            <el-button @click="handleClick(scope.row)" type="text"
              >编辑</el-button
            >
            <el-button @click="handleClick(scope.row)" type="text"
              >详情</el-button
            >
            <el-button @click="deleter(scope.row)" type="text"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>

   
    <!-- 弹窗 -->
    <div class="mask" v-show="masknum">
      <div class="content">
        <div class="content-top">
          <span>申请优惠券</span>
          <span @click="masknum = false" style="color:#fff;margin-right:15px;">X</span>
        </div>
        <div class="content-main">
          <div class="item">
            <span class="item-text">优惠券名称</span>
            <input type="text" />
          </div>
          <div class="item">
            <span class="item-text">优惠券类型</span>
            <el-select v-model="couponCategory" placeholder="请选择优惠券类型">
              <el-option
                v-for="item in couponOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </div>
          <div class="item">
            <span class="item-text">使用范围</span>
            <el-select placeholder="请选择使用范围" v-model="syfw">
              <el-option
                v-for="item in couponOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </div>
          <div class="item">
            <span class="item-text">发放数量</span>
            <input type="text" />
          </div>
          <div class="item">
            <span class="item-text">规则</span>
            <label>满</label>
            <input class="small-input" type="text" />
            <label>元，</label>
            <label>减</label>
            <input class="small-input" type="text" />
            <label>元。</label>
          </div>
          <div class="item">
            <span class="item-text"></span>
            <label>满</label>
            <input class="small-input" type="text" />
            <label>元，</label>
            <label>打</label>
            <input class="small-input" type="text" />
            <label>折。</label>
          </div>
          <div class="item">
            <span class="item-text"></span>
            <label>无门槛，</label>
            <label>减</label>
            <input class="small-input" type="text" />
            <label>元。</label>
          </div>
          <div class="item" id="use-time">
            <span class="item-text">使用时间</span>
            <el-date-picker
              v-model="dateVuale1"
              type="date"
              placeholder="选择日期"
            ></el-date-picker>
            <label>至</label>
            <el-date-picker
              v-model="dateVuale2"
              type="date"
              placeholder="选择日期"
            ></el-date-picker>
          </div>
        </div>
        <div class="search-btn">
           <el-button type="primary" @click="masknum = false" size="medium" plain>确定</el-button>
           <el-button type="primary" @click="masknum = false" size="medium" plain>取消</el-button>
        </div>
      </div>
    </div>
     <!--删除 弹窗 -->
    <div class="mask" v-show="delet">
      <div class="contented">
          <div class="item" style="padding:60px 20px 0 20px;">
            <span class="item-text" style="width:100%;">您确定要删除"6元满减券"吗？删除后，创建活动时不可以使用该券。</span>
          </div>
        <div class="search-btnt" >
           <el-button type="primary" @click="delet = false" size="medium" plain>确定</el-button>
           <el-button type="primary" @click="delet = false" size="medium" plain>取消</el-button>
        </div>
      </div>
    </div>
     <!-- 详情弹窗 -->
    <div class="mask" v-show="xiangq">
      <div class="content">
        <div class="content-top">
          <span>申请优惠券</span>
          <span @click="masknum = false" style="color:#fff;margin-right:15px;">X</span>
        </div>
        <div class="content-main">
          <div class="item">
            <span class="item-text">优惠券名称</span>
            <input type="text" />
          </div>
          <div class="item">
            <span class="item-text">优惠券类型</span>
            <el-select v-model="couponCategory" placeholder="请选择优惠券类型">
              <el-option
                v-for="item in couponOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </div>
          <div class="item">
            <span class="item-text">使用范围</span>
            <el-select placeholder="请选择使用范围" v-model="syfw">
              <el-option
                v-for="item in couponOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </div>
          <div class="item">
            <span class="item-text">发放数量</span>
            <input type="text" />
          </div>
          <div class="item">
            <span class="item-text">规则</span>
            <label>满</label>
            <input class="small-input" type="text" />
            <label>元，</label>
            <label>减</label>
            <input class="small-input" type="text" />
            <label>元。</label>
          </div>
          <div class="item">
            <span class="item-text"></span>
            <label>满</label>
            <input class="small-input" type="text" />
            <label>元，</label>
            <label>打</label>
            <input class="small-input" type="text" />
            <label>折。</label>
          </div>
          <div class="item">
            <span class="item-text"></span>
            <label>无门槛，</label>
            <label>减</label>
            <input class="small-input" type="text" />
            <label>元。</label>
          </div>
          <div class="item" id="use-time">
            <span class="item-text">使用时间</span>
            <el-date-picker
              v-model="dateVuale1"
              type="date"
              placeholder="选择日期"
            ></el-date-picker>
            <label>至</label>
            <el-date-picker
              v-model="dateVuale2"
              type="date"
              placeholder="选择日期"
            ></el-date-picker>
          </div>
        </div>
        <div class="search-btn">
           <el-button type="primary" @click="xiangq = false" size="medium" plain>确定</el-button>
           <el-button type="primary" @click="xiangq = false" size="medium" plain>取消</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      masknum: false, //遮罩
      delet:false,//删除弹窗
      xiangq:false,//详情弹窗
      couponCategory: "", //优惠券类型
      couponOptions: [
        //合同状态
        { label: "满减券", value: "选项1" },
        { label: "折扣券", value: "选项2" },
        { label: "现金券", value: "选项3" },
      ],
      dateVuale1: "",
      dateVuale2: "",
      syfw:"",
      arr:[]
      // arr: [
      //   {
      //     couponName:3333,
      //     couponType:444444444
      //   }
      // ],
    };
  },
  mounted() {
     this.loadShopList() 
  },
  methods: {
      //获取优惠券表数据
    loadShopList() {
      // var param = {

      // };
      this.axios({
        url: "/coupon/list",
        method: "post",
      }).then((res) => {
          this.arr = res.data.data.list;
      });
    },
    addCoupon() {},
    handleClick(){
       this.xiangq=true
    },
    //删除
    deleter(){
      this.delet=true
    }
  },
  watch: {},
};
</script>

<style scoped>
/* 设置input框的高度 */
input {
  height: 30px;
}
.title {
  margin: 20px 0;
}
.table {
  margin-top: 20px;
}
.is-coupon {
  width: 650px;
  margin: 36px auto;
}
.coupon-category {
  font-family: SourceHanSansSC-regular;
  font-size: 20px;
  margin-bottom: 30px;
}
.is-coupon span {
  display: inline-block;
  text-align: center;
  margin-top: 20px;
  color: #101010;
  width: 80px;
  line-height: 28px;
  margin-left: 140px;
  box-sizing: border-box;
}
.go-back {
  border: 1px solid #9cbbbbbb;
  background: #ffffff;
}

/* 遮罩 */
.mask {
  width: 100vw;
  height: 100vh;
  /* color: #555; */
  background: rgba(51, 51, 51, 0.692);
  position: fixed;
  z-index: 99;
  top: 0;
  left: 0;
}
.mask .content {
  width: 690px;
  height: 550px;
  background: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.mask .contented {
  width: 600px;
  height: 250px;
  background: #fff;
  position: absolute;
  border-radius: 5px;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
}
 .content-top {
  width:675px;
  height: 50px;
  display:flex;
  justify-content: space-between;

  background: #3668ee;
  line-height: 50px;
  padding-left: 15px;
  color: #dce4fc;
} 
.mask .content span img {
  position: absolute;
  right: 10px;
  width: 20px;
  top: 15px;
}

.content-main {
 
  padding: 10px;
}
 .item-text {
  width: 100px;
  text-align:center;
  display: inline-block;
  margin-right: 10px;
}
.content-main .item {
  width: 360px;
  margin:10px 0  6px 80px;
}
.small-input {
  width: 45px;
  margin: 0 5px;
}
#use-time {
  width: 100% !important;
}
.search-btn {
  position: absolute;
  top:85%;
  left: 40%;
  transform: translate(-50%);
}
.search-btnt {
  position: absolute;
  top:60%;
  left: 50%;
  transform: translate(-50%);
}
</style>